package deibay.client.commands;

import deibay.client.Command;
import deibay.client.Controller;
import deibay.datamodel.Item;
import deibay.messages.Message;
import deibay.messages.SendSellerItemDetailsMsg;

public class SendSellerItemDetailsCommand extends Command{

	public SendSellerItemDetailsCommand(Controller controller, Message msg) {
		super(controller, msg);
	}

	@Override
	public void execute() {
		SendSellerItemDetailsMsg msg = (SendSellerItemDetailsMsg)message;
		Item item = msg.getItem();
		controller.getSellerController().getViewItemDetails().setName(item.getName());
		controller.getSellerController().getViewItemDetails().setDescription(item.getDescription());
		controller.getSellerController().getViewItemDetails().setSeller(item.getSeller());
		controller.getSellerController().getViewItemDetails().setBidder(item.getBidder());
		if(item.getCategory()!=null)
			controller.getSellerController().getViewItemDetails().setCategory(item.getCategory().toString());
		controller.getSellerController().getViewItemDetails().setStartPrice(item.getStartPrice());
		controller.getSellerController().getViewItemDetails().setDeadline(item.getFinishTime());
		controller.getSellerController().getViewItemDetails().setActualPrice(item.getActualPrice());
		controller.getSellerController().getViewItemDetails().setID(item.getId());		
	}

}
